#include "light/led.h"

int led_on(led_t* led)
{
	led->ops.gpio_set_val(led->cfg.fix.level);
	led->priv.state = LED_ON;
	return 0;
}

int led_off(led_t* led)
{
	led->ops.gpio_set_val(1 - led->cfg.fix.level);
	led->priv.state = LED_OFF;
	return 0;
}

int led_turn(led_t* led)
{
	if (led->priv.state == LED_ON) {
		led_off(led);
	} else {
		led_on(led);
	}

	return 0;
}
